<template>
  <el-dialog
    :visible="visible"
    width="800px"
    :before-close="handleClose"
    custom-class="listitem-dialog"
    append-to-body
  >
    <div class="listitem-content-align dialog-flex-layout">
      <slot></slot>
    </div>
    <span slot="footer" class="dialog-footer">
      <el-button @click="close">关闭</el-button>
    </span>
  </el-dialog>
</template>

<script>
export default {
  name: "ListitemDialog",
  props: {
    visible: {
      type: Boolean,
      required: true
    }
  },
  methods: {
    handleClose() {
      this.$emit('update:visible', false); 
    },
    close() {
      this.$emit('update:visible', false);
    }
  }
};
</script>

<style scoped>
.listitem-dialog ::v-deep .el-dialog__header,
.listitem-dialog ::v-deep .el-dialog__body,
.listitem-dialog ::v-deep .el-dialog__footer {
  background: #f8fafc;
  color: #232526;
  border: 1.5px solid #b3c6e8;
  border-radius: 16px;
}
.listitem-dialog ::v-deep .el-dialog {
  border: 1.5px solid #b3c6e8;
  border-radius: 16px;
  background: #f8fafc;
}
.listitem-dialog ::v-deep .el-dialog__title {
  color: #409eff !important;
  font-weight: bold;
  letter-spacing: 1px;
}
.dialog-footer .el-button {
  border-radius: 8px;
  font-size: 16px;
  height: 40px;
  background: #e9f0fb;
  border: none;
  color: #409eff;
  font-weight: 500;
}
.dialog-footer .el-button:hover {
  background: #b3c6e8;
  color: #fff;
}
.listitem-content-align {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 100px;
  padding: 18px 0 8px 0;
  box-sizing: border-box;
}
.dialog-flex-layout {
  gap: 18px;
  align-items: flex-start;
}
@media (max-width: 900px) {
  .listitem-content-align {
    padding: 8px 0 4px 0;
  }
}
</style>
